Reliability of duplicate document detection algorithms

ABSTRACT

In a single-signature duplicate document system, a secondary set of attributes is used in addition to a primary set of attributes so as to improve the precision of the system. When the projection of a document onto the primary set of attributes is below a threshold, then a secondary set of attributes is used to supplement the primary lexicon so that the projection is above the threshold.

CLAIM OF PRIORITY

The present application is a continuation of U.S. patent applicationSer. No. 13/185,238, filed on Jul. 18, 2011, which is a continuation ofU.S. patent application Ser. No. 12/144,021, filed on Jun. 23, 2008 nowissued as U.S. Pat. No. 7,984,029, which is a continuation of U.S.patent application Ser. No. 11/016,959, filed on Dec. 21, 2004 nowissued as U.S. Pat. No. 7,392,262, which claims the benefit of andpriority to U.S. provisional application No. 60/580,379, filed Jun. 18,2004, U.S. provisional application No. 60/562,298, filed on Apr. 15,2004, and U.S. provisional application No. 60/543,283, filed Feb. 11,2004. Each of the aforementioned patent(s) and application(s) are herebyincorporated by reference in their entirety.

TECHNICAL FIELD

This description relates to duplicate detection and spam filtering.

BACKGROUND

With the advent of the Internet and a decline in computer prices, manypeople are communicating with one another through computersinterconnected by networks. A number of different communication mediumshave been developed to facilitate such communications between computerusers. One type of prolific communication medium is electronic mail(e-mail).

Unfortunately, because the costs of sending e-mail are relatively low,e-mail recipients are being subjected to mass, unsolicited, commerciale-mailings (colloquially known as e-mail spam or spam e-mails). Theseare akin to junk mail sent through the postal service. However, becausespam e-mail requires neither paper nor postage, the costs incurred bythe sender of spam e-mail are quite low when compared to the costsincurred by conventional junk mail senders. Due to this and otherfactors, e-mail users now receive a significant amount of spam e-mail ona daily basis. Spam e-mail impacts both e-mail users and e-mailproviders. For e-mail users, spam e-mail can be disruptive, annoying,and time consuming. For an e-mail service provider, spam e-mailrepresents tangible costs in terms of storage and bandwidth usage. Thesecosts may be substantial when large numbers of spam e-mails are sent.

SUMMARY

In general, when detecting a duplicate document, a primary lexicon ofattributes and a secondary lexicon of attributes are generated andunique attributes in a document are determined. An intersection betweenthe unique attributes in the document and the primary lexicon is alsodetermined. When the intersection does not exceed a threshold,attributes from the secondary lexicon that intersect with the uniqueattributes in the document are added to the intersection to create anaugmented intersection that exceeds the threshold. A signature for thedocument is calculated based on the augmented intersection.

Implementations may include one or more of the following features. Forexample, the threshold may be a minimum number of attributes or aminimum percentage of the unique attributes in the document. Thedocument may be an e-mail and the unique attributes may include tokens,where the tokens include words in a body of the e-mail. The attributesin the primary lexicon, the attributes in the secondary lexicon, or theunique attributes may include words.

The document may be an unknown document and the signature may be a querysignature. The query signature may be compared to known signaturesgenerated from a set of known documents to determine whether the unknowndocument is a duplicate of one of the set of known documents.

A signature for the document may be calculated based on the intersectionwhen the intersection exceeds the threshold.

To generate the primary and secondary lexicons, a set of documents maybe parsed to obtain unique attributes in the set of documents. Thenormalized inverse document frequency for the unique attributes in theset of documents may be calculated. The primary lexicon may be definedas the unique attributes in the set of documents that have a normalizedinverse document frequency within a selected range, while the secondarylexicon may be defined as the unique attributes in the set of documentsthat have a normalized inverse document frequency outside the selectedrange, such as, for example, above the selected range. The set ofdocuments may be a set of known spam e-mails or a set of trainingdocuments.

To determine the intersection between the unique attributes in thedocument and the primary lexicon, an intersection may be determinedbetween the unique attributes in the document and the unique attributesin the set of documents to obtain a set of common attributes. Anormalized inverse document frequency for the common attributes from theunique attributes in the set of documents may be obtained and the commonattributes may be ranked according to the normalized inverse documentfrequency of the common attributes. The common attributes that have anormalized inverse document frequency within the selected range may beselected to obtain a set of intersection attributes.

To determine whether the intersection exceeds a threshold comprises, athreshold percentage may be multiplied times a number of the uniqueattributes in the document to obtain a preliminary threshold number. Thepreliminary threshold number may be compared to a specified thresholdnumber to determine whether the preliminary threshold number exceeds thespecified threshold number. A number of attributes in the set ofintersection attributes may be compared to the preliminary thresholdnumber when the preliminary threshold number exceeds the specifiedthreshold number. A number of attributes in the set of intersectionattributes may be compared to the specified threshold number when thepreliminary threshold number does not exceed the specified thresholdnumber.

To add attributes from the secondary lexicon that intersect with theunique attributes in the document to the intersection to create anaugmented intersection that exceeds the threshold, an additional numberof attributes needed to achieve the threshold may be determined andadditional attributes may be selected equal to the additional number ofattributes from the set of common attributes that have a normalizedinverse document frequency outside of the specified range. The selectedattributes may be added to the set of intersection attributes. Theselected attributes may be attributes that have a normalized inversedocument frequency above the specified range in an increasing order ofthe normalized document frequency of the additional attributes.

Implementations of the described techniques may include hardware, amethod or process, or computer software on a computer-accessible medium.

The details of one or more implementations are set forth in theaccompanying drawings and the description below. Other features will beapparent from the description and drawings, and from the claims.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram of an exemplary networked computingenvironment that supports e-mail communications and in which spamfiltering may be performed.

FIG. 2 is a high-level functional block diagram of an e-mail serverprogram that may execute on an e-mail server to provide large-scale spamfiltering.

FIG. 3 is a flowchart of a process that may be employed by an e-mailfilter to apply a single-signature-based duplicate detection techniqueto identify spam e-mails.

FIG. 4 is a flowchart of a process that may be used to implement actions310 and 320 in FIG. 3 and which employs a secondary lexicon ofattributes to increase the reliability or precision of single-signatureduplicate detection techniques.

FIGS. 5-8 are flowcharts of exemplary implementations of actions 405,415, 420 and 425, respectively, in FIG. 4 for an implementation of theprocess of FIG. 4 based on the I-Match approach.

DETAILED DESCRIPTION

In a single-signature duplicate document system, a secondary set ofattributes is used in addition to a primary set of attributes so as toimprove the precision of the system. Generally, in single-signature, orsingle-fingerprint, based duplicate detection systems, two documents areconsidered identical if their projections onto a lexicon of attributesare the same (where the attributes are typically those that havecharacteristics useful for identifying a given document). To determinewhether the projections are the same, the projection of each document isnormally mapped to a single signature, and when two documents'signatures match, they are considered to be duplicates.

Single-signature techniques, however, may provide false positives whenthe projection of a document onto the lexicon of attributes is small,thereby decreasing the precision of the technique. To mitigate thedecrease in precision, when the projection of the document on thelexicon of attributes is below a threshold, then a secondary lexicon ofattributes is used to supplement the primary lexicon so that theprojection is above the threshold.

Such duplicate detection techniques are described below as applied toe-mail spam filtering. However, the techniques may be used for spamfiltering in other messaging media, including both text and non-textmedia. For example, spam may be sent using instant messaging or shortmessage service (SMS), or may appear on Usenet groups. Similarly, thetechniques may be applied, for instance, to filter spam sent in the formof images, sounds, or video when an appropriate set of attributes isselected.

Moreover, the techniques described may be applied to duplicate detectionproblems other than spam filtering. For example, duplicate detection ofdocuments is also useful in Internet search engines and newsfeedapplications. For Internet search engines, duplicate detection may beused to eliminate duplicate documents stored as part of the searchengine database, or to eliminate duplicate documents from being returnedto the user as part of the search results. For newsfeed applications,duplicate detection may be used to insure only one copy of a story isbeing fed to the user.

More generally, the described techniques may be applied to text ornon-text items in a variety of document duplication applications.Therefore, the term “document” should be understood to generally referto a computer file that contains data for use by applications, such as,for example, a file that contains text, images, sounds, video, othermedia, or a combination thereof. Accordingly, while described below asbeing text, the attributes may be text or non-text attributes such thatthe lexicons of attributes or unique attributes in a document mayinclude both text and non-text attributes, only text attributes, or onlynon-text attributes.

FIG. 1 illustrates an exemplary networked computing environment 100 thatsupports e-mail communications and in which spam filtering may beperformed. Computer users are distributed geographically and communicateusing client systems 110 a and 110 b. Client systems 110 a and 110 b areconnected to ISP networks 120 a and 120 b, respectively. Whileillustrated as ISP networks, networks 120 a or 120 b may be any network,e.g. a corporate network. Clients 110 a and 110 b may be connected tothe respective ISP networks 120 a and 120 b through variouscommunication channels such as a modem connected to a telephone line(using, for example, serial line internet protocol (SLIP) orpoint-to-point protocol (PPP)) or a direct network connection (using,for example, transmission control protocol/internet protocol (TCP/IP)).E-mail or other messaging servers 130 a and 130 b also are connected toISP networks 120 a and 120 b, respectively. ISP networks 120 a and 120 bare connected to a global network 140 (e.g., the Internet) such that adevice on one ISP network can communicate with a device on the other ISPnetwork. For simplicity, only two ISP networks 120 a and 120 b have beenillustrated as connected to Internet 140. However, there may be a largenumber of such ISP networks connected to Internet 140. Likewise, manye-mail servers and many client systems may be connected to each ISPnetwork.

Each of the client systems 110 a and 110 b and e-mail servers 130 a and130 b may be implemented using, for example, a general-purpose computercapable of responding to and executing instructions in a defined manner,a personal computer, a special-purpose computer, a workstation, aserver, a device such as a personal digital assistant (PDA), acomponent, or other equipment or some combination thereof capable ofresponding to and executing instructions. Client systems 110 a and 110 band e-mail servers 130 a and 130 b may receive instructions from, forexample, a software application, a program, a piece of code, a device, acomputer, a computer system, or a combination thereof, whichindependently or collectively direct operations. These instructions maytake the form of one or more communications programs that facilitatecommunications between the users of client systems 110 a and 110 b. Suchcommunications programs may include, for example, e-mail programs, IMprograms, file transfer protocol (FTP) programs, or voice-over-IP (VoIP)programs. The instructions may be embodied permanently or temporarily inany type of machine, component, equipment, storage medium, or propagatedsignal that is capable of being delivered to a client system 110 a and110 b or the e-mail servers 130 a and 130 b.

Each of client systems 110 a and 110 b and e-mail servers 130 a and 130b includes a communications interface (not shown) used by thecommunications programs to send communications. The communications mayinclude e-mail, audio data, video data, general binary data, or textdata (e.g., data encoded in American Standard Code for InformationInterchange (ASCII) format or Unicode).

Examples of ISP networks 120 a and 120 b include Wide Area Networks(WANs), Local Area Networks (LANs), analog or digital wired and wirelesstelephone networks (e.g., a Public Switched Telephone Network (PSTN), anIntegrated Services Digital Network (ISDN), or a Digital Subscriber Line(xDSL)), or any other wired or wireless network including, e.g., acorporate LAN of WAN. Networks 120 a and 120 b may include multiplenetworks or subnetworks, each of which may include, for example, a wiredor wireless data pathway.

Each of e-mail servers 130 a and 130 b may handle e-mail for usersconnected to ISP network 110 a or 110 b. Each e-mail server may handlee-mail for a single e-mail domain (e.g., aol.com), for a portion of adomain, or for multiple e-mail domains. While not shown, there may bemultiple, interconnected e-mail servers working together to providee-mail service.

An e-mail user, such as a user of client system 110 a or 110 b,typically has one or more e-mail mailboxes on an e-mail system, whichmay incorporate e-mail server 130 a or 130 b. Each mailbox correspondsto an e-mail address. Each mailbox may have one or more folders in whiche-mail is stored. E-mail sent to one of the e-mail user's e-mailaddresses is routed to the corresponding e-mail server 130 a or 130 band placed in the mailbox that corresponds to the e-mail address towhich the e-mail was sent. The e-mail user then uses, for example, ane-mail client program executing on client system 110 a or 110 b toretrieve the e-mail from e-mail server 130 a or 130 b and view thee-mail.

The e-mail client programs executing on client systems 110 a and 110 balso may allow one of the users to send e-mail to an e-mail address. Forexample, the e-mail client program executing on client system 110 a mayallow the e-mail user of client system 110 a (the sending user) tocompose an e-mail message and address the message to a recipientaddress, such as an e-mail address of the user of client system 110 b.When the sender indicates the e-mail is to be sent to the recipientaddress, the e-mail client program executing on client system 110 acommunicates with e-mail server 130 a to handle the sending of thee-mail to the recipient address. For an e-mail addressed to an e-mailuser of client system 110 b, for example, e-mail server 130 a sends thee-mail to e-mail server 130 b. E-mail server 130 b receives the e-mailand places it in the mailbox that corresponds to the recipient address.The user of client system 110 b may then retrieve the e-mail from e-mailserver 130 b, as described above.

In an e-mail environment such as that shown, a spammer typically uses ane-mail client or server program to send similar spam e-mails tohundreds, if not millions, of e-mail recipients. For example, a spammermay target hundreds of recipient e-mail addresses serviced by e-mailserver 130 b on ISP network 120 b. The spammer may maintain the list oftargeted recipient addresses as a distribution list. The spammer may usethe e-mail program to compose a spam e-mail and instruct the e-mailprogram to use the distribution list to send the spam e-mail to therecipient addresses. The e-mail is then sent to e-mail server 130 b fordelivery to the recipient addresses. Thus, in addition to receivinglegitimate e-mails, e-mail server 130 b also may receive largequantities of spam e-mail, particularly when many hundreds of spammerstarget e-mail addresses serviced by e-mail server 130 b.

Thus, e-mail systems tend to be used by any given spammer to send largenumbers of substantially similar, although non-identical, e-mails. Whilethe content of each spam e-mail contains essentially the same message,the content of each e-mail is normally varied to a degree. For example,mass e-mailings are often personalized by including the recipient user'sfirst/last name or other personal information. Spammers also may addrandom text to their e-mails so as to foil some spam detection schemes,such as those based on matching exact textual strings in the e-mail.Usually, the core message of the e-mail remains the same, with random orneutral text added to confuse such “exact-match” spam filters. Often theextra text is inserted in such a way that it is not immediately visibleto the users (e.g., when the font has the same color as the background).Other randomization strategies of spammers include: appending randomcharacter strings to the subject line of the e-mail, changing the orderof paragraphs, or randomizing the non-alphanumeric content.

Furthermore, spammers also may change the words used in the e-mail toconvey their message. However, because spam e-mails are typicallyoriented around the same topics (e.g., pornography), the expressivenessof their content is limited. Thus, even though spammers may attempt torandomize the content of their e-mails, the limitation on theexpressiveness of their content results in essentially the same e-mailbeing sent out, even though the e-mails are not exactly identical.

Consequently, duplicate detection systems that identify nearly identicaldocuments may be useful to filter spam e-mails, either when they enteran e-mail system or later on in the e-mail system (e.g., at therecipient's client system). Identification of spam e-mails at the entrypoint of an e-mail system may be particularly desirable from the e-mailservice provider's perspective, as detection at that point may allow thee-mail service provider to prevent the propagation of such e-mailsthrough the system, thereby reducing the waste of computation andstorage resources on unsolicited messages.

Referring to FIG. 2, to provide spam filtering by duplicate detection atthe entry point of an e-mail system, an e-mail server program 230 mayexecute on an e-mail system (which may incorporate e-mail server 130 aor 130 b). E-mail server program 230 includes an e-mail filter 232 and amail handler 234. During operation, the incoming e-mail arriving ate-mail server program 230 is passed to e-mail filter 232. E-mail filter232 applies duplicate detection techniques to the e-mail to determinewhether the e-mail is a spam e-mail or a legitimate e-mail (i.e., not aspam e-mail) and forwards the e-mail to mail handler 234, along with anindication of whether the e-mail is spam or not.

Mail handler 234 then handles the e-mail in a manner that depends on thepolicies set by the e-mail service provider. For example, mail handler234 may delete e-mails indicated as spam, while delivering e-mailsmarked as legitimate to an “inbox” folder of the corresponding e-mailaccount. Alternatively, e-mail labeled as spam may be delivered to a“spam” folder instead of being deleted.

Referring to FIG. 3, a process 300 may be employed by e-mail filter 232to apply a single-signature-based duplicate detection technique toidentify spam e-mails. In single-signature, or single-fingerprint, basedduplicate detection systems, two documents are considered to be the sameif their projections onto a lexicon of attributes are the same (wherethe attributes are typically those that have characteristics useful foridentifying a given document). To determine whether the projections arethe same, the projection of each document is normally mapped to a singlesignature, and when two documents' signatures match, they are consideredto be duplicates.

For example, in the I-Match approach described by Chowdhury et al. in“Collection Statistics For Fast Duplicate Document Detection,” ACMTransactions on Information Systems, 20(2):171-191, 2002 [hereinafterChowdhury], two documents are considered to be the same if theprojection of the unique words in the documents onto a lexicon of wordsis the same. To that end, a lexicon of words is developed, where thewords chosen are those that have characteristics useful for specificallyidentifying a given document. More particularly, in I-Match, the lexiconis developed by examining a collection of documents and selecting thewords in the collection that have a mid-range inverse document frequency(idf) or normalized inverse document frequency (nidf) (described morefully below).

For a given document, the set of unique words (i.e., each differentword) in the document is identified. For example, if the word “cabin” isused in a document multiple times, it is listed once in the set ofunique words. The intersection between the set of unique words and thelexicon is obtained (i.e., the words that are in both the lexicon andthe set of unique words are identified). This intersection is thenmapped to a single hash value using a hash algorithm such as the SecureHash Algorithm 1 (SHA1) developed by the National Institute of Standardsand Technology (described in Chowdhury and in RFC 3174, available athttp://www.faqs.org/rfcs/rfc3174.html). If the hash value matches thehash value of another document, then the two documents are considered tobe duplicates of one another.

Using such techniques, after a collection of known spam e-mails has beenobtained, the signatures of the known spam e-mails may be calculated andthen used to determine if new e-mails are duplicates of the known spame-mails, and hence, are spam e-mails themselves. Accordingly, in process300, a set of known spam e-mails is received by e-mail filter 232 (305).

The set of known spam e-mails may be collected in a number of ways. Forexample, “honeypot” e-mail accounts may be used to collect spam e-mails.A honeypot e-mail account is one set up by an e-mail service providerthat does not belong to a legitimate user. The address of the honeypotaccount is then made available, for example, on websites, usenet groups,or other places where a spammer can obtain the address. Because ahoneypot account does not belong to a legitimate user, it should notreceive any legitimate e-mails; rather the e-mails received by thataccount should be spam e-mails. Another manner of collecting spame-mails may include direct user feedback. To obtain direct userfeedback, an e-mail service provider may implement tools orcommunication channels that allow its users to report spam e-mails thatare received. This may be effective because at least some users may beeager to report and/or complain about received spam e-mails. Once acollection of spam e-mails is obtained, human analysts, for example, mayreview the e-mails to eliminate e-mails that are an exact duplicate ofanother e-mail in the set. The analysts also may eliminate e-mails thathave the exact same message as another e-mail in the set (even thoughnon-message randomization techniques have been applied to make thee-mails non-exact duplicates). The set of known spam e-mails is thenprovided to e-mail filter 232.

E-mail filter 232 then applies signature-based duplicate detectiontechniques to obtain a signature (a “spam signature”) for each e-mail inthe set of known spam e-mails (310). When the e-mail filter 232subsequently receives an incoming e-mail (315), e-mail filter 232applies the duplicate detection techniques to the incoming e-mail toobtain a single signature of the e-mail (a “query signature”) (320).E-mail filter 232 then compares the query signature to the spamsignatures to determine if the query signature matches one of the spamsignatures (325). If the query signature does not match a spam signature(325), then e-mail filter 232 forwards the incoming e-mail to e-mailhandler 234 with an indication that the incoming e-mail is legitimate.On the other hand, if the query signature does match a spam signature(325), then the incoming e-mail is forwarded to the mail handler 234with an indication that the e-mail is spam. E-mail handler 234 thenhandles the incoming e-mail accordingly.

Single-signature techniques, such as I-Match, however, may provide falsepositives when the projection of a document onto the attributes issmall, thereby decreasing the precision of the technique. For example,in the I-Match approach, when the intersection between the set of uniquewords in a document and the lexicon of words is small, the words used togenerate the signature may only be a small portion of the document and,therefore, not very representative of the document. This may result, forinstance, in a long document that has the same or nearly the sameintersection as a different, smaller document, and, consequently, theI-Match approach may indicate that the longer document is the same asthe smaller document, even if this is not the case. In other words, inthe I-Match approach, for example, the signature of a document isdefined as a hashed representation of the intersection S=(L∩U) (where Lis the lexicon and U is the unique words in a document) and thissignature becomes unreliable when

$\frac{S}{U}$

becomes too small.

To mitigate such effects in single-signature techniques, a secondarylexicon of attributes (which may be less effective in identifying agiven document) may be used to supplement the primary lexicon ofattributes when the projection of the document onto the primary lexiconof attributes is below a certain threshold.

Referring to FIG. 4, e-mail filter 232 may implement actions 310 and 320by using a process 400, which employs a secondary lexicon of attributesto mitigate the above described effects in single-signature techniquesso as to increase the reliability or precision of such techniques. Theattributes may be, e.g., words, phrases or other clusters of words, HTMLtags or other features contained in the body of an e-mail. A word may bedefined as a set of alphanumeric characters delimited by whitespace.Additionally, the attributes may be tokenized.

A primary lexicon of tokens L and a secondary lexicon of tokens B aregenerated (405). The primary lexicon L contains tokens that havecharacteristics useful for specifically identifying a given document.The secondary lexicon B also has tokens that have characteristics usefulfor specifically identifying a given document, but the tokens in thesecondary lexicon B may be ones that have characteristics that are notas useful as those in the primary lexicon L. For example, the primarylexicon L can be created by analyzing a set of documents to identify bysome measure, such as the idf or nidf (described below), those tokensthat are most useful in identifying a document and selecting thosetokens as the primary lexicon L. The secondary lexicon B then may becreated by selecting some or all of the remaining tokens that were inthe documents.

For a given e-mail d, e-mail filter 232 then determines the uniquetokens U in e-mail d (410). When action 310 is implemented by process400, e-mail d is one of the e-mails in the set of known spam e-mails. Onthe other hand, when action 320 is implemented by process 400, e-mail dis the incoming e-mail. To determine the unique tokens U, e-mail filter232 may, for example, parse the body of e-mail d to tokenize thecontents of the body and retain a given token if that token has not beenencountered before in the body of e-mail d. In some implementations,e-mail filter 232 may only retain attributes that meet certain criteria(e.g., is at least four characters long or has only one digit) and mayapply a common formatting to the attributes (e.g., change all letters tolower case).

Next, e-mail filter 232 determines the intersection between uniquetokens U and the primary lexicon L (i.e., e-mail filter 232 determineswhich tokens in U are also in the primary lexicon L) (415). Theintersection is then evaluated to determine if it is above a certainthreshold (420). The threshold may be, for example, a minimum number oftokens that is common between the unique tokens U and the primarylexicon L and/or a minimum proportion of common tokens to the tokenscontained in U. The value of the threshold is generally a matter ofdesign and may be chosen by the system designers through trial anderror, with the threshold selected to obtain a target precision of thesystem.

If the intersection is below the threshold (425), then tokens fromsecondary lexicon B that also intersect with the unique tokens U areincluded in the intersection to achieve an intersection above thethreshold. This augmented intersection is then used to calculate thesignature for e-mail d (420) by applying an algorithm that generates asingle signature to the augmented intersection. On the other hand, ifthe original intersection is above the threshold, then the originalintersection is used to calculate the signature for e-mail d (430) byapplying an algorithm that generates a single signature to the originalintersection.

If there is another e-mail in the set of known spam e-mails or anotherincoming e-mail (depending on whether process 400 is implementing action310 or 320), then process 400 moves to action 410 to find the uniquetokens in the other e-mail and the process continues as described above.Otherwise, process 400 is ended and the signature for e-mail d is thenstored for future use as a spam signature or compared to a spamsignature as a query signature (depending on whether process 400 isimplementing action 310 or 320) (440).

FIGS. 5-8 illustrate exemplary implementations of actions 405, 415, 420and 425, respectively, for an implementation of process 400 based on theI-Match approach.

Referring to FIG. 5, a process 500 is used to generate a primary lexiconL and a secondary lexicon B (action 405). In process 500, a set ofdocuments are used to generate the lexicons. The set of documents may bea training set of documents, related or unrelated to spam e-mails, orthe documents may be the set of known spam e-mails, or a combination ofboth. Even if a large diverse collection of training documents unrelatedto spam e-mail is used to generate the lexicons, the lexicons may stillbe capable of being used to detect duplicates in the spam e-mails. Inother words, lexicons generated from a large and diverse set ofdocuments are capable of being used not only to detect duplicates ofthose documents in the collection, but also documents in differentcollections. For example, an experiment involved the use of a lexiconcreated from a corpus of 1.6 million different web pages (which werepreviously used in the I-Match experiments described in Chowdhury).These lexicons were used in an implementation of process 400 similar tothat depicted in FIGS. 5-8, and performed well. This experiment isdescribed in greater detail in U.S. Provisional Patent Application Ser.No. 60/543,283, filed on Feb. 11, 2004.

The ability to use a training collection that can be applied to detectdocuments in different collections may be useful in the context of spamfiltering because the content distribution of spam is constantlychanging (i.e., the content or topics of spam are constantly changing).The ability to use a training collection for different documents meansthat the lexicon(s) do not need to be constantly updated as spamchanges, rather, as long as the signatures for the new spam e-mails arecalculated and used, e-mail filter 232 should continue to operate welleven as the content of spam changes.

Accordingly, in process 500, a set of training documents (related to orunrelated to spam e-mail) is obtained (505), the set of known spame-mails is used instead (510), or a combination of the two is used togenerate the lexicons. To do so, the set of documents used is parsed toobtain the unique tokens in the set of documents (515). Next, the nidfof the unique tokens in the set is calculated (520) according to:

$\begin{matrix}{{{N\; I\; D\; F_{i}} = \frac{I\; D\; F_{i}}{\max \mspace{14mu} I\; D\; F}},} \\{{I\; D\; F_{i}} = {\log \frac{N}{n_{i}}}}\end{matrix}$

where N is the total number of documents in the set, n_(i) is the numberof documents in the set that contain token i, and max IDF is the maximumIDF value for the unique tokens. Thus, for example, to calculate thenidf for a particular token, e-mail filter 232 may initially calculatethe IDF for all of the unique tokens and then divide the idf for theparticular token by the maximum idf value.

Once the nidfs for the unique tokens in the set of documents arecalculated, the unique tokens and their respective nidfs are used as alexicon C. The tokens that have nidfs between a specified range areconsidered to be the primary lexicon L, while the tokens that have nidfsabove the specified range are considered to be the secondary lexicon B.Generally, those tokens with mid-range nidfs are considered to be theones that are most useful in identifying a particular document. In otherwords, those tokens that occur very frequently in the set and those thatoccur infrequently are generally not considered to be as useful inidentifying a particular document. Accordingly, the range is generallyspecified to span those tokens with mid-range nidfs. The exact choice ofthe specified range is generally in the discretion of the systemdesigner and may involve a degree of trial and error to determine therange that is most useful in a particular system. An exemplary rangethat may be suitable in some systems is the range of nidfs between 0.2and 0.3. As such, the primary lexicon L in this case is considered to bethose tokens with nidfs between 0.2 and 0.3, while the secondary lexiconB is considered to be those tokens with nidfs above 0.3.

Referring to FIG. 6, a process 600 is used to determine the intersectionbetween unique tokens U and the primary lexicon L (action 415). Prior toprocess 600, the unique tokens U in e-mail d are determined (410). A setof common tokens is obtained by determining the intersection between theunique tokens U and the lexicon C (i.e., e-mail filter 232 determineswhich tokens in U are also in the lexicon C and uses these as a set ofcommon tokens) (605). The common tokens are then ranked according totheir nidf (which was obtained from the nidfs contained in lexicon C,i.e., from the nidfs of the unique tokens in the set of documents)(610). The common tokens that have nidfs between the specified rangethat corresponds to the primary lexicon L are selected to obtain a setof intersection tokens, which are the intersection between the uniquetokens U and the primary lexicon L.

Referring to FIG. 7, a process 700 is used to determine if theintersection between the unique tokens U and lexicon L is above thethreshold (action 420). In process 700, both a threshold number oftokens and a threshold proportion of unique tokens are used.Specifically, the intersection between the unique tokens U and theprimary lexicon L (i.e., the set of intersection tokens) must contain atleast a threshold number of tokens (e.g., 5 tokens) or must be at leasta threshold proportion or percentage (e.g., 10%) of the unique tokens U,whichever is greater.

The threshold percentage or proportion is multiplied times the number ofunique tokens U to determine a preliminary threshold number (705). Ifthe preliminary threshold is greater than or equal to the specifiedthreshold number (710), then a comparison is made between the number ofintersection tokens and the preliminary threshold number to determinewhether the number of tokens in the intersection set is greater than orequal to the preliminary threshold number (715). If so, then theintersection is above the threshold (730). If not, then the intersectionis not above the threshold (720).

If the preliminary threshold is greater than or equal to the specifiedthreshold number (710), then a comparison is made between the number ofintersection tokens and the specified threshold number to determine ifthe number of intersection tokens is greater than or equal to thespecified threshold number (725). If so, then the intersection is abovethe threshold (730). If not, then the intersection is not above thethreshold (720).

The following is an example of process 700 applied to a first set ofunique tokens U with 100 tokens, and a second one with 40 tokens whenthe specified threshold number is 5 and the specified thresholdpercentage is 10%. For the first set, 10% is multiplied times 100 toobtain a preliminary threshold number of 10 tokens (705). In this case,the preliminary threshold number (i.e., 10) is greater than thespecified threshold number (i.e., 5) (710). Thus, for an intersectioncontaining less than 10 tokens (715) the threshold is not met (720),while the threshold is met (730) for an intersection containing 10 ormore tokens.

In contrast, for the second set, the preliminary threshold number isless than the specified threshold number (710) (i.e., 10%×40=4, which isless than the specified threshold number 5). Accordingly, the thresholdis not met (720) for an intersection that contains less than 5 tokens,but the threshold is met (730) for an intersection with 5 or moretokens.

Referring to FIG. 8, a process 800 is used to add tokens from thesecondary lexicon B to the intersection to achieve the threshold (action425). Based on process 700, the additional number of tokens need toachieve the threshold is determined (805). This can be determined, forexample, by taking the difference between number of tokens in theintersection set and the preliminary threshold number or the specifiedthreshold number, depending on the situation that resulted in thethreshold not being met. For instance, following the example above, forthe first set of unique tokens U that contains 100 tokens, thedifference between the number of tokens in the intersection set and thepreliminary threshold number is calculated, while the difference betweenthe number of tokens in the intersection set and the specified thresholdnumber is calculated for the second set that contains 40 tokens.

Next, additional tokens from lexicon C are selected (810). Theadditional tokens selected equal the additional number to achieve thethreshold and are selected from the tokens that are considered to bepart of lexicon B, i.e., have an nidf above the specified range (e.g.,tokens with an nidf greater than 0.3 when a specified range of 0.2 to0.3 is used). The additional tokens also may be selected in rank orderfrom the lowest nidf in the portion above the specified range to thehighest nidf in the portion above the specified range. The tokens may beselected in this order to help insure that the additional tokens havesimilar nidf characteristics to the ones used from the primary lexicon Land, therefore, are more useful in identifying a particular document. Asan example, if two tokens where needed to achieve the threshold, andthree tokens have nidfs in range considered to be the secondary lexiconB, then the two tokens with the lowest nidf would be selected.

The additional tokens are then added to the set of intersection tokensto achieve an intersection that is above the threshold (815).

When process 400 is implemented based on an I-Match approach, the set ofintersection tokens (which is the intersection) then is used tocalculate the signature for the e-mail d (430). To do so, a hashalgorithm that maps the set of intersection tokens to a single hashvalue may be used, where the single hash value is the signature for thee-mail d. For example, the SHA1 algorithm as described and implementedin Chowdhury may be used. The hash value is then stored as a spamsignature or used as a query signature, depending on whether process 400is implementing action 310 or 320.

The above-described techniques also may be used as an integrated systemof spam filtering. For example, the duplicate detection techniques maybe used to quickly identify and eliminate near-duplicates of spam e-mailat the entry point of an e-mail system. The e-mails that are notidentified as spam based on duplicate detection may then be classifiedusing, for instance, machine learning techniques. To that end, thee-mails may be provided to a naïve Bayesian classifier or a SupportVector Machine (SVM) based classifier, for instance, which thenevaluates the e-mail content and classifies the e-mail as spam ornon-spam. Thus, in the system of FIG. 2, for example, mail handler 234may forward the e-mail that is indicated as not being spam to aclassifier for classification as spam or non-spam.

The techniques described above are not limited to any particularhardware or software configuration. Rather, they may be implementedusing hardware, software, or a combination of both. The methods andprocesses described may be implemented as computer programs that areexecuted on programmable computers comprising at least one processor andat least one data storage system. The programs may be implemented in ahigh-level programming language and may also be implemented in assemblyor other lower level languages, if desired.

Any such program will typically be stored on a computer-usable storagemedium or device (e.g., CD-Rom, RAM, or magnetic disk). When read intothe processor of the computer and executed, the instructions of theprogram cause the programmable computer to carry out the variousoperations described above.

A number of implementations have been described. Nevertheless, it willbe understood that various modifications may be made. For example, insome places in the foregoing description an action is described asperformed on each e-mail in a group (e.g., a spam signature is obtainedfor each e-mail in the set of known spam e-mails); however, theperformance of the actions on each e-mail is not necessarily required.For instance, with respect to spam signatures, a spam signature may notbe obtained for each known spam e-mail because of certain restrictionsplaced on signatures, such as the requirement that the intersection beabove a threshold before a signature is generated. Thus, if an augmentedintersection above a certain threshold can not be obtained for aparticular spam e-mail, then the e-mail may be ignored and a signaturenot generated for it. Similarly, there may be restrictions on the numberof unique tokens required. For instance, a spam e-mail may be requiredto contain a minimum number of unique tokens (e.g., 5) before it isused.

Additionally, in other implementations where the foregoing techniquesare applied to spam filtering in other messaging media or other areas ofduplicate detection, the attributes may be other features of theparticular items being classified. For instance, the attributes may ben-grams, image features, sound features, or features extracted fromother forms of media.

Accordingly, implementations other than those specifically described arewithin the scope of the following claims.

What is claimed is:
 1. A method for use in detecting a duplicatedocument, the method comprising: generating a primary lexicon ofattributes and a secondary lexicon of attributes; determining uniqueattributes in a document; determining an intersection between the uniqueattributes in the document and the primary lexicon; determining whetherthe intersection exceeds a threshold; when the intersection does notexceed the threshold, adding attributes from the secondary lexicon thatintersect with the unique attributes in the document to the intersectionto create an augmented intersection that exceeds the threshold; andcalculating a signature for the document based on the augmentedintersection.